package com.wanxi.student;

import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;

public class TestStudentConstruct {
    public static void main(String[] args) {
        Map<StudentConstruct, String> map = new TreeMap<>(new Comparator<StudentConstruct>() {
            @Override
            public int compare(StudentConstruct o1, StudentConstruct o2) {
                return o1.getName().compareTo(o2.getName());
            }
        });
        map.put(new StudentConstruct("张三1", 22), "成都1");
        map.put(new StudentConstruct("张三2", 20), "成都2");
        map.put(new StudentConstruct("张三3", 21), "成都3");
        map.put(new StudentConstruct("张三4", 27), "成都4");
        System.out.println(map);
    }
}
